<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 100px;
            height: 100px;
        }
    </style>
</head>
<body>
    <div id="app">
        <h1>
            {{msg}}
            {{say()}}
        </h1>
        <h3 v-text="msg"></h3>
        <h3 v-html=" reverse(content.toUpperCase()) " :title="title"></h3>
        <input type="text" v-model="msg">
        <div v-show="flag1" style="background-color: red;" v-once></div><button @click="flag1=!flag1">改变</button>
        <div v-if="flag2" style="background-color: green;"></div><button @click="flag2=!flag2">改变</button>


        <table border="1" width='400' height='300'>
            <tr>
                <th></th>
                <th>id</th>
                <th>姓名</th>
                <th>年龄</th>
                <th>性别</th>
                <th>操作</th>
            </tr>
            <tr v-for="item,index in stuList" :key="item.id">
                <td><input type="checkbox" ></td>
                <td>{{item.id}}</td>
                <td>{{item.name}}</td>
                <td>{{item.age}}</td>
                <td>{{item.sex}}</td>
                <td><button @click='delet(index)'>删除</button></td>
            </tr>
        </table>
    </div>
    <script src="../js/vue.js"></script>
    <script>
        Vue.config.devtools = true;
        var vm = new Vue({
            el:'#app',
            data:{
                msg:'hello vue',
                age:'18',
                content:`hello刘为大傻逼`,
                title:'刘为',
                flag1:true,
                flag2:true,
                stuList:[
                    {
                        id:1,
                        name:'刘为傻逼',
                        age:31,
                        sex:'女'
                    },
                     {
                        id: 2,
                        name: '刘为真傻逼',
                        age: 21,
                        sex: '男'
                    },
                     {
                        id: 3,
                        name: '刘为就是傻逼',
                        age: 32,
                        sex: '女'
                    }
                ]
            },
            methods: {
                say:function(){
                    return 'say hello'
                },
                reverse(val){
                    return val.split('').reverse().join('');
                },
                delet(index){
                    this.stuList.splice(index,1);
                }
            },
        })
    </script>
</body>
</html>